#region Using References

using System.Diagnostics.CodeAnalysis;
using System.IO;
using Beaker.OpenCube.Game;
using Beaker.OpenCube.Nbt;

#endregion

namespace Beaker.OpenCube.Specs.Builders
{
	[ExcludeFromCodeCoverage]
	public sealed class PlayerDataStreamBuilder
		: Builder<Stream>
	{
		protected override Stream OnBuild()
		{
			return
				new NbtStreamBuilder()
					.Append( NbtTag.Compound, string.Empty )
						.Append( NbtTag.Compound, "Data" )
							// Entity
							.Append( NbtTag.List, "Pos" )
								.Append( NbtTag.Double ).Append( 3 )
								.Append( 0d )
								.Append( 0d )
								.Append( 0d )
							.Append( NbtTag.List, "Motion" )
								.Append( NbtTag.Double ).Append( 3 )
								.Append( 0d )
								.Append( 0d )
								.Append( 0d )
							.Append( NbtTag.List, "Rotation" )
								.Append( NbtTag.Float ).Append( 2 )
								.Append( 0f )
								.Append( 0f )
							.Append( NbtTag.Float, "FallDistance" ).Append( 0f )
							.Append( NbtTag.Short, "Fire" ).Append( (short)0 )
							.Append( NbtTag.Short, "Air" ).Append( (short)300 )
							.Append( NbtTag.Byte, "OnGround" ).Append( (byte)1 )
							.Append( NbtTag.Int, "Dimension" ).Append( (int)Dimension.Overworld )
							.Append( NbtTag.Byte, "Invulnerable" ).Append( (byte)0 )
							.Append( NbtTag.Int, "PortalCooldown" ).Append( 0 )
							.Append( NbtTag.String, "CustomName" ).Append( "Foobar" )
							// Mob
							.Append( NbtTag.Short, "Health" ).Append( (short)20 )
							.Append( NbtTag.Short, "AttackTime" ).Append( (short)20 )
							.Append( NbtTag.Short, "HurtTime" ).Append( (short)0 )
							.Append( NbtTag.Short, "DeathTime" ).Append( (short)0 )
							.Append( NbtTag.List, "Equipment" )
								.Append( NbtTag.Compound ).Append( 5 )
								.Append( NbtTag.End )
								.Append( NbtTag.End )
								.Append( NbtTag.End )
								.Append( NbtTag.End )
								.Append( NbtTag.End )
							.Append( NbtTag.List, "DropChances" )
								.Append( NbtTag.Float ).Append( 5 )
								.Append( 0.1f )
								.Append( 0.1f )
								.Append( 0.1f )
								.Append( 0.1f )
								.Append( 0.1f )
							.Append( NbtTag.Byte, "CanPickUpLoot" ).Append( (byte)1 )
							.Append( NbtTag.Byte, "PersistenceRequired" ).Append( (byte)0 )
							.Append( NbtTag.Byte, "CustomNameVisible" ).Append( (byte)0 )
							// Player
							.Append( NbtTag.Int, "playerGameType" ).Append( (int)GameMode.Creative )
							.Append( NbtTag.Int, "Score" ).Append( 0 )
							.Append( NbtTag.Int, "SelectedItemSlot" ).Append( 0 )
							.Append( NbtTag.Int, "SpawnX" ).Append( 0 )
							.Append( NbtTag.Int, "SpawnY" ).Append( 0 )
							.Append( NbtTag.Int, "SpawnZ" ).Append( 0 )
							.Append( NbtTag.Byte, "SpawnForced" ).Append( (byte)0 )
							.Append( NbtTag.Byte, "Sleeping" ).Append( (byte)0 )
							.Append( NbtTag.Short, "SleepTimer" ).Append( (short)0 )
							.Append( NbtTag.Int, "foodLevel" ).Append( 20 )
							.Append( NbtTag.Float, "foodExhaustionLevel" ).Append( 0f )
							.Append( NbtTag.Float, "foodSaturationLevel" ).Append( 0f )
							.Append( NbtTag.Int, "foodTickTimer" ).Append( 0 )
							.Append( NbtTag.Int, "XpLevel" ).Append( 0 )
							.Append( NbtTag.Float, "XpP" ).Append( 0f )
							.Append( NbtTag.Int, "XpTotal" ).Append( 0 )
						.Append( NbtTag.End )
					.Append( NbtTag.End )
					.Build();
		}
	}
}